#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
#include <set>
#include <map>
using namespace std;
const int N = 100;
bool lock;

deque<int> wq;//waiting queue
queue<int> sq;//stoping queue
vector<string> prg[N];


int main()
{
	int cas=0,n=0,t1=0,t2=0,t3=0,t4=0,t5=0,Q=0;
	scanf("%d\n",&cas);
	while(cas--){
		scanf("&n %d %d %d %d %d %d\n",&n,&t1,&t2,&t3,&t4,&t5,&Q);
		string line;
		for(int i=1;i<=n;i++){
			while(getline(cin,line)){
				if(s == "") continue;
				prg[i].push_back(line);
				if(prg[i].end() == "end") break;
			}
		}

	}

	for(int i=1;i<=n;i++){
		for(auto it = prg[i].begin();it != prg[i].end();it++)
		cout<<it<<endl;
	}
	return 0;
}
